package com.eaoa.uc.address.bo;

import com.eaoa.base.EABaseBusinessObject;
import com.eaoa.dao.pub.PubCityDAO;
import com.eaoa.vo.pub.PubCity;

public class PubCityEditBO extends EABaseBusinessObject{
	private PubCity vo;
	private PubCityDAO cityDAO = new PubCityDAO();
	
	public PubCityEditBO(PubCity vo) {
		super();
		this.vo=vo;
	}
	
	@Override
	protected void performBusinessLogic() {
		if(vo.getCityno()==null){
			vo.setIslock("N");
			cityDAO.save(vo);
		}else{
			PubCity po = (PubCity)cityDAO.loadAndLock(vo.getCityno());
			po.setCityname(vo.getCityname());
			po.setParentno(vo.getParentno());
			po.setSort(vo.getSort());
			cityDAO.saveOrUpdate(po);
		}
	}
}
